from flask import request, jsonify
from server.nurse import psychological_list_server
from api import psychological_list_api

@psychological_list_api.route('/read', methods=['GET'])
def read():
    result = psychological_list_server.list_read()
    return result

@psychological_list_api.route('/delete', methods=['POST'])
def delead():
    data = request.json
    result = psychological_list_server.id_delete(data)
    return result

@psychological_list_api.route('/add', methods=['POST'])
def add():
    data = request.json
    result = psychological_list_server.add(data)
    return result

@psychological_list_api.route('/update', methods=['POST'])
def update():
    data = request.json
    result = psychological_list_server.update(data)
    return result

@psychological_list_api.route('/num_info', methods=['POST'])
def num_info():
    data = request.json
    print("data = ", data)
    result = psychological_list_server.num_info(data)
    return result

# @psychological_list_api.route('/importing', methods=['POST'])
# def importing():
#     # 检查请求中是否包含文件
#     if 'file' not in request.files:
#         return jsonify({"error": "No file part"}), 400
#
#     file = request.files['file']
#     print(f"file的文件是 = {file}")
#
#     result = psychological_list_server.importing(file)
#     return result
